package Action;

import java.io.IOException;
import java.util.List;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import Dao.machinedao;
import Dao.maintenancedao;
import Entity.Machine;
import Entity.Maintenance;
import mapper.Machinemapper;
import mapper.Maintenancemapper;

/**
 * Servlet implementation class DamageServlet
 */
@WebServlet("/DamageServlet")
public class DamageServlet extends HttpServlet {
	private static final long serialVersionUID = 1L;
       
    /**
     * @see HttpServlet#HttpServlet()
     */
    public DamageServlet() {
        super();
        // TODO Auto-generated constructor stub
    }

	/**
	 * @see HttpServlet#service(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		// TODO Auto-generated method stub
		String room_id = request.getParameter("room_id");
		Machinemapper mm = new machinedao();
		List<Machine> lm = mm.getAllMachineByrId(room_id);
		request.setAttribute("lm",lm);
		request.setAttribute("room", room_id);
		request.getRequestDispatcher("pop_computer.jsp").forward(request,response);
	}

}
